package com.iss;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;

public class Test {

	public static Connection conn = null;

	public static void main(String[] args) throws SQLException, ClassNotFoundException {
		Connection con = ConnectionUtil.getConnection();
		String sql = "select cjt_cmd(?,?) score,answer from question ";
		PreparedStatementUtil pu = new PreparedStatementUtil();
		PreparedStatement psm = pu.getPreparedStatemen(con, sql);
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入题号:");
		int questionid = sc.nextInt();
		System.out.println("请输入答案:");
		String stuanswer = sc.next();
		psm.setInt(1, questionid);
		psm.setString(2, stuanswer);
		ResultSet rs = ResultsetUtil.getResult(psm);
		if (rs.next()) {
			System.out.println(rs.getString("score"));
			System.out.println(rs.getString("answer"));
		}
		rs.close();
		psm.close();
		conn.close();
	}

}
